﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.controllers.world {
    import flash.events.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.interfaces.*;
    import net.wooga.pets.constants.*;

    public class CreatePatientCommand extends CreateActorCommand {

        override public function execute():void{
            var _local1:Object = event.info;
            var _local2:ITreatable = (worldFactory.createActor(_local1) as ITreatable);
            var _local3:IRoom = (worldModel.getRoomById(_local2.roomId) as IRoom);
            setActor(_local2, EventConstants.CREATE_PATIENT_VIEW);
            _local3.handlePatient(_local2);
            dispatch(new InfoEvent(EventConstants.CHECK_FOUNTAIN_TUTORIAL, null, {patient:_local2}));
        }
        public function fixedActorData(_arg1:Object):Object{
            var _local2:String = worldModel.getRoomIdsOfType(GameConstants.TYPE_RECEPTION)[0];
            var _local3:IRoom = IRoom(worldModel.getRoomById(_local2));
            var _local4:IRoom = IRoom(worldModel.getRoomById(_arg1[ProtocolConstants.ROOM_ID]));
            if ((((_local4.type == GameConstants.TYPE_ENTRANCE_AREA)) && ((_local3.reservedBy == null)))){
                _arg1[ProtocolConstants.ROOM_ID] = _local2;
                _local3.reservedBy = _arg1[ProtocolConstants.ID];
                dispatch(new Event(EventConstants.DISPATCH_SEND_AMBULANCE_AWAY));
            };
            return (_arg1);
        }

    }
}//package net.wooga.pets.controllers.world 
